import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { RegistrationVO, RegistrationForm, RegistrationQuery, RefundForm } from '@/api/system/registration/types';

/**
 * 查询挂号记录列表
 * @param query
 * @returns {*}
 */

export const listRegistration = (query?: RegistrationQuery): AxiosPromise<RegistrationVO[]> => {
  return request({
    url: '/system/registration/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询挂号记录详细
 * @param id
 */
export const getRegistration = (id: string | number): AxiosPromise<RegistrationVO> => {
  return request({
    url: '/system/registration/' + id,
    method: 'get'
  });
};

/**
 * 新增挂号记录
 * @param data
 */
export const addRegistration = (data: RegistrationForm) => {
  return request({
    url: '/system/registration',
    method: 'post',
    data: data
  });
};

/**
 * 修改挂号记录
 * @param data
 */
export const updateRegistration = (data: RegistrationForm) => {
  return request({
    url: '/system/registration',
    method: 'put',
    data: data
  });
};

/**
 * 删除挂号记录
 * @param id
 */
export const delRegistration = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/registration/' + id,
    method: 'delete'
  });
};
